package pingji.controller.register;

import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pingji.controller.ResponseObject;
import pingji.service.register.RegisterService;

@RestController
@Log
@CrossOrigin(origins = "*")
public class Register {
    @Autowired
    private RegisterService service;
    @RequestMapping("/register")
    public ResponseObject register(@RequestBody RegisterObject param){
        log.info(param.toString());
        if("".equals(param.getUsername())||"".equals(param.getPassword())){
            return new ResponseObject(1,"name or password is null");
        }
        //校验参数正确进入调用Service
        return service.registerService(param);
    }
}
